package org.nstack.network.service.vip;

import org.springframework.http.HttpMethod;
import org.nstack.header.identity.Action;
import org.nstack.header.message.APICreateMessage;
import org.nstack.header.message.APIParam;
import org.nstack.header.network.l3.IpAllocateMessage;
import org.nstack.header.network.l3.L3NetworkMessage;
import org.nstack.header.network.l3.L3NetworkVO;
import org.nstack.header.rest.RestRequest;


@Action(category = VipConstant.ACTION_CATEGORY)
@RestRequest(
        path = "/vips",
        method = HttpMethod.POST,
        responseClass = APICreateVipEvent.class,
        parameterName = "params"
)
public class APICreateVipMsg extends APICreateMessage implements L3NetworkMessage, IpAllocateMessage {

    @APIParam(maxLength = 255)
    private String name;

    @APIParam(required = false, maxLength = 2048)
    private String description;

    @APIParam(resourceType = L3NetworkVO.class)
    private String l3NetworkUuid;

    private String allocatorStrategy;

    private String requiredIp;

    public String getRequiredIp() {
        return requiredIp;
    }

    public void setRequiredIp(String requiredIp) {
        this.requiredIp = requiredIp;
    }

    public void setAllocatorStrategy(String allocationStrategy) {
        this.allocatorStrategy = allocationStrategy;
    }

    @Override
    public String getL3NetworkUuid() {
        return l3NetworkUuid;
    }

    public void setL3NetworkUuid(String l3NetworkUuid) {
        this.l3NetworkUuid = l3NetworkUuid;
    }

    @Override
    public String getAllocatorStrategy() {
        return allocatorStrategy;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
 
    public static APICreateVipMsg __example__() {
        APICreateVipMsg msg = new APICreateVipMsg();
        msg.setName("vip1");
        msg.setL3NetworkUuid(uuid());
        msg.setRequiredIp("10.0.0.2");
        return msg;
    }

}
